//
//  NSString+OAURLEncodingAdditions.m
//  sc
//
//  Created by SeeKool on 14-5-9.
//  Copyright (c) 2014年 SeeKool Inc. All rights reserved.
//

#import "NSString+OAURLEncodingAdditions.h"

@implementation NSString (OAURLEncodingAdditions)

- (NSString *)URLEncodeString
{
    NSString *result = (NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
                                                                           (CFStringRef)self,
                                                                           NULL,
                                                                           CFSTR("!*'();:@&=+$,/?%#[]"),
                                                                           kCFStringEncodingUTF8));

    return result;
}


- (NSString *)URLDecodeString
{
    NSString*result = (NSString *)CFBridgingRelease(CFURLCreateStringByReplacingPercentEscapesUsingEncoding(kCFAllocatorDefault,
                                                                                          (CFStringRef)self,
                                                                                          CFSTR(""),
                                                                                          kCFStringEncodingUTF8));
    return result;
} 



@end
